$(function(){
	
	//登录页背景随机
	var rand = Math.floor((Math.random() * 5) + 1);
	$('body')
	.css('background', 'url('+ ThinkPHP['IMG'] +'/login_bg'+ rand +'.jpg) no-repeat')
	.css('background-size', '100%');
	
	//登录按钮
	$('#login input[type="submit"]').button();
	
	//注册对话框
	$('#reg').dialog({
		width 	  : 400,
		height 	  : 300,
		modal 	  : true,
		title 	  : '注册',
		autoOpen  : false,
		resizable : false,
		closeText : '关闭',
		buttons   : [{
			text  : '提交',
			click : function(e) {
				$(this).submit();
			}
		}]
	}).validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit({
				url  : ThinkPHP['MODULE'] +'/User/reg',
				type : 'POST'
			});
		}
	});
	
	//点击注册弹窗
	$('#regBtn').click(function(){
		$('#reg').dialog('open');
	})
});